<template>
  <div class="physical-examination-reports">
    <!-- 顶部状态栏 -->
    <div class="status-bar">
      <div class="status-left">9:41</div>
      <div class="status-right">
        <div class="signal"></div>
        <div class="wifi"></div>
        <div class="battery"></div>
      </div>
    </div>

    <!-- 头部导航 -->
    <div class="header">
      <div class="back-button" @click="goBack">
        <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
          <path d="M19 12H5M12 19l-7-7 7-7"/>
        </svg>
      </div>
      <h1 class="page-title">体检报告</h1>
      <div class="header-actions">
        <div class="action-icon" @click="toggleSearch">
          <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
            <circle cx="11" cy="11" r="8"/>
            <path d="m21 21-4.35-4.35"/>
          </svg>
        </div>
        <div class="action-icon" @click="toggleFilter">
          <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
            <polygon points="22,3 2,3 10,12.46 10,19 14,21 14,12.46"/>
          </svg>
        </div>
      </div>
    </div>

    <!-- 搜索区域 -->
    <div class="search-section" v-if="showSearch">
      <div class="search-input-wrapper">
        <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="search-icon">
          <circle cx="11" cy="11" r="8"/>
          <path d="m21 21-4.35-4.35"/>
        </svg>
        <input 
          type="text" 
          v-model="searchQuery" 
          @input="handleSearch"
          placeholder="搜索体检报告..." 
          class="search-input"
        />
        <div v-if="searchQuery" class="clear-button" @click="clearSearch">
          <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
            <line x1="18" y1="6" x2="6" y2="18"/>
            <line x1="6" y1="6" x2="18" y2="18"/>
          </svg>
        </div>
      </div>
    </div>

    <!-- 筛选区域 -->
    <div class="filter-section" v-if="showFilter">
      <div class="filter-tabs">
        <div 
          class="filter-tab" 
          :class="{ active: activeFilter === 'all' }"
          @click="setFilter('all')"
        >
          全部报告
        </div>
        <div 
          class="filter-tab" 
          :class="{ active: activeFilter === 'normal' }"
          @click="setFilter('normal')"
        >
          正常
        </div>
        <div 
          class="filter-tab" 
          :class="{ active: activeFilter === 'abnormal' }"
          @click="setFilter('abnormal')"
        >
          异常
        </div>
        <div 
          class="filter-tab" 
          :class="{ active: activeFilter === 'favorite' }"
          @click="setFilter('favorite')"
        >
          收藏
        </div>
      </div>
    </div>

    <!-- 报告列表 -->
    <div class="reports-list" ref="listContainer" @scroll="handleScroll">
      <div 
        v-for="report in displayedReports" 
        :key="report.id" 
        class="report-item"
        @click="viewReport(report)"
      >
        <div class="report-icon">
          <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
            <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
            <polyline points="14,2 14,8 20,8"/>
            <line x1="16" y1="13" x2="8" y2="13"/>
            <line x1="16" y1="17" x2="8" y2="17"/>
            <polyline points="10,9 9,9 8,9"/>
          </svg>
        </div>
        <div class="report-details">
          <div class="report-title">{{ report.title }}</div>
          <div class="report-info">
            <span class="report-date">{{ report.date }}</span>
            <span class="report-hospital">{{ report.hospital }}</span>
          </div>
          <div class="report-status" :class="report.status">
            <span class="status-text">{{ getStatusText(report.status) }}</span>
          </div>
        </div>
        <div class="report-actions">
          <div 
            class="favorite-button" 
            :class="{ active: report.isFavorite }"
            @click.stop="toggleFavorite(report)"
          >
            <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
            </svg>
          </div>
          <div class="arrow">
            <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <path d="M9 18l6-6-6-6"/>
            </svg>
          </div>
        </div>
      </div>

      <!-- 加载更多 -->
      <div v-if="isLoading" class="load-more">
        <div class="loading-spinner">
          <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
            <path d="M21 12a9 9 0 11-6.219-8.56"/>
          </svg>
        </div>
        <span>加载中...</span>
      </div>

      <!-- 没有更多数据 -->
      <div v-if="!hasMore && displayedReports.length > 0" class="no-more">
        <span>没有更多数据了</span>
      </div>

      <!-- 空状态 -->
      <div v-if="displayedReports.length === 0 && !isLoading" class="empty-state">
        <div class="empty-icon">
          <svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
            <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
            <polyline points="14,2 14,8 20,8"/>
            <line x1="16" y1="13" x2="8" y2="13"/>
            <line x1="16" y1="17" x2="8" y2="17"/>
            <polyline points="10,9 9,9 8,9"/>
          </svg>
        </div>
        <h3>暂无体检报告</h3>
        <p>您还没有体检报告记录</p>
      </div>
    </div>

    <!-- 报告详情模态框 -->
    <div v-if="showReportModal" class="modal-overlay" @click="closeReportModal">
      <div class="modal-content" @click.stop>
        <div class="modal-header">
          <h2>{{ selectedReport?.title }}</h2>
          <div class="close-button" @click="closeReportModal">
            <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
              <line x1="18" y1="6" x2="6" y2="18"/>
              <line x1="6" y1="6" x2="18" y2="18"/>
            </svg>
          </div>
        </div>
        
        <div class="modal-body">
          <div class="report-summary">
            <div class="summary-item">
              <span class="label">检查日期：</span>
              <span class="value">{{ selectedReport?.date }}</span>
            </div>
            <div class="summary-item">
              <span class="label">检查医院：</span>
              <span class="value">{{ selectedReport?.hospital }}</span>
            </div>
            <div class="summary-item">
              <span class="label">检查状态：</span>
              <span class="value status" :class="selectedReport?.status">
                {{ getStatusText(selectedReport?.status) }}
              </span>
            </div>
          </div>

          <div class="doctor-analysis">
            <h3>医生分析</h3>
            <div class="analysis-content">
              <div class="doctor-info">
                <div class="doctor-avatar">
                  <img :src="selectedReport?.doctorAvatar" alt="医生头像" />
                </div>
                <div class="doctor-details">
                  <div class="doctor-name">{{ selectedReport?.doctorName }}</div>
                  <div class="doctor-title">{{ selectedReport?.doctorTitle }}</div>
                </div>
              </div>
              <div class="analysis-text">
                {{ selectedReport?.doctorAnalysis }}
              </div>
              <div class="analysis-date">
                分析时间：{{ selectedReport?.analysisDate }}
              </div>
            </div>
          </div>

          <div class="report-details-section">
            <h3>检查详情</h3>
            <div class="details-list">
              <div v-for="(detail, index) in selectedReport?.details" :key="index" class="detail-item">
                <div class="detail-header">
                  <span class="detail-title">{{ detail.title }}</span>
                  <span class="detail-value" :class="detail.status">{{ detail.value }}</span>
                </div>
                <div v-if="detail.description" class="detail-description">
                  {{ detail.description }}
                </div>
              </div>
            </div>
          </div>
        </div>

        <div class="modal-footer">
          <button class="btn-secondary" @click="closeReportModal">关闭</button>
          <button class="btn-primary" @click="downloadReport">下载报告</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, computed, onMounted, nextTick } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()

// 响应式数据
const searchQuery = ref('')
const showSearch = ref(false)
const showFilter = ref(false)
const activeFilter = ref('all')
const isLoading = ref(false)
const hasMore = ref(true)
const currentPage = ref(1)
const pageSize = ref(10)
const listContainer = ref<HTMLElement>()
const showReportModal = ref(false)
const selectedReport = ref<any>(null)

// 生成模拟数据
const generateMockReports = () => {
  const reports = []
  const titles = [
    '年度体检报告',
    '入职体检报告',
    '健康体检报告',
    '专项体检报告',
    '入职前体检',
    '定期体检报告',
    '健康评估报告',
    '体检复查报告'
  ]
  
  const hospitals = [
    '北京协和医院',
    '北京大学第一医院',
    '北京天坛医院',
    '北京安贞医院',
    '北京友谊医院',
    '北京同仁医院',
    '北京积水潭医院',
    '北京朝阳医院'
  ]

  const doctors = [
    { name: '张医生', title: '主任医师', avatar: 'https://randomuser.me/api/portraits/men/32.jpg' },
    { name: '李医生', title: '副主任医师', avatar: 'https://randomuser.me/api/portraits/women/44.jpg' },
    { name: '王医生', title: '主治医师', avatar: 'https://randomuser.me/api/portraits/men/67.jpg' },
    { name: '刘医生', title: '主任医师', avatar: 'https://randomuser.me/api/portraits/women/23.jpg' }
  ]

  const analyses = [
    '根据体检结果，您的各项指标基本正常。建议继续保持良好的生活习惯，定期进行体检。',
    '体检结果显示您的身体状况良好，但需要注意控制饮食，适量运动，保持健康的生活方式。',
    '您的体检结果总体正常，建议增加运动量，改善作息时间，定期复查相关指标。',
    '体检发现一些轻微异常，建议您注意休息，调整饮食结构，必要时进行进一步检查。',
    '您的身体状况良好，各项指标都在正常范围内，继续保持当前的生活方式即可。',
    '体检结果显示您的健康状况良好，建议定期进行体检，保持健康的生活方式。',
    '根据体检结果，您的身体各项指标正常，建议继续保持良好的生活习惯和饮食习惯。',
    '您的体检结果总体良好，建议适当增加运动量，注意营养均衡，定期体检。'
  ]

  const details = [
    {
      title: '血常规',
      value: '正常',
      status: 'normal',
      description: '白细胞、红细胞、血小板等指标均在正常范围内'
    },
    {
      title: '肝功能',
      value: '正常',
      status: 'normal',
      description: '转氨酶、胆红素等指标正常'
    },
    {
      title: '肾功能',
      value: '正常',
      status: 'normal',
      description: '肌酐、尿素氮等指标正常'
    },
    {
      title: '血糖',
      value: '偏高',
      status: 'warning',
      description: '空腹血糖略高于正常值，建议控制饮食'
    },
    {
      title: '血压',
      value: '正常',
      status: 'normal',
      description: '收缩压和舒张压均在正常范围内'
    },
    {
      title: '心电图',
      value: '正常',
      status: 'normal',
      description: '心电图显示心律正常，无异常波形'
    }
  ]

  for (let i = 0; i < 50; i++) {
    const doctor = doctors[Math.floor(Math.random() * doctors.length)]
    const status = Math.random() > 0.7 ? 'abnormal' : 'normal'
    const isFavorite = Math.random() > 0.8
    
    reports.push({
      id: i + 1,
      title: titles[Math.floor(Math.random() * titles.length)],
      date: new Date(Date.now() - Math.random() * 365 * 24 * 60 * 60 * 1000).toLocaleDateString('zh-CN'),
      hospital: hospitals[Math.floor(Math.random() * hospitals.length)],
      status,
      isFavorite,
      doctorName: doctor.name,
      doctorTitle: doctor.title,
      doctorAvatar: doctor.avatar,
      doctorAnalysis: analyses[Math.floor(Math.random() * analyses.length)],
      analysisDate: new Date(Date.now() - Math.random() * 30 * 24 * 60 * 60 * 1000).toLocaleDateString('zh-CN'),
      details: details.slice(0, Math.floor(Math.random() * 4) + 3) // 随机选择3-6项详情
    })
  }
  
  return reports
}

const allReports = ref(generateMockReports())
const displayedReports = ref<any[]>([])

// 计算属性
const filteredReports = computed(() => {
  let filtered = allReports.value

  // 按状态筛选
  if (activeFilter.value === 'normal') {
    filtered = filtered.filter(report => report.status === 'normal')
  } else if (activeFilter.value === 'abnormal') {
    filtered = filtered.filter(report => report.status === 'abnormal')
  } else if (activeFilter.value === 'favorite') {
    filtered = filtered.filter(report => report.isFavorite)
  }

  // 按搜索关键词筛选
  if (searchQuery.value) {
    const query = searchQuery.value.toLowerCase()
    filtered = filtered.filter(report => 
      report.title.toLowerCase().includes(query) ||
      report.hospital.toLowerCase().includes(query) ||
      report.doctorName.toLowerCase().includes(query)
    )
  }

  return filtered
})

// 方法
const goBack = () => {
  router.back()
}

const toggleSearch = () => {
  showSearch.value = !showSearch.value
  if (!showSearch.value) {
    searchQuery.value = ''
    resetData()
  }
}

const toggleFilter = () => {
  showFilter.value = !showFilter.value
}

const handleSearch = () => {
  resetData()
}

const clearSearch = () => {
  searchQuery.value = ''
  resetData()
}

const setFilter = (filter: string) => {
  activeFilter.value = filter
  resetData()
}

const getStatusText = (status: string) => {
  switch (status) {
    case 'normal':
      return '正常'
    case 'abnormal':
      return '异常'
    case 'warning':
      return '注意'
    default:
      return '未知'
  }
}

const viewReport = (report: any) => {
  selectedReport.value = report
  showReportModal.value = true
}

const closeReportModal = () => {
  showReportModal.value = false
  selectedReport.value = null
}

const toggleFavorite = (report: any) => {
  report.isFavorite = !report.isFavorite
}

const downloadReport = () => {
  // 模拟下载功能
  console.log('下载报告:', selectedReport.value?.title)
  alert('报告下载功能开发中...')
}

const loadMoreData = async () => {
  if (isLoading.value || !hasMore.value) return
  
  isLoading.value = true
  
  // 模拟网络延迟
  await new Promise(resolve => setTimeout(resolve, 500))
  
  const start = (currentPage.value - 1) * pageSize.value
  const end = start + pageSize.value
  const newReports = filteredReports.value.slice(start, end)
  
  displayedReports.value.push(...newReports)
  currentPage.value++
  
  hasMore.value = displayedReports.value.length < filteredReports.value.length
  isLoading.value = false
}

const resetData = () => {
  displayedReports.value = []
  currentPage.value = 1
  hasMore.value = true
  loadMoreData()
}

const handleScroll = () => {
  if (!listContainer.value) return
  
  const { scrollTop, scrollHeight, clientHeight } = listContainer.value
  if (scrollTop + clientHeight >= scrollHeight - 50) {
    loadMoreData()
  }
}

// 生命周期
onMounted(() => {
  loadMoreData()
})
</script>

<style scoped lang="scss">
.physical-examination-reports {
  min-height: 100vh;
  background: #f5f5f5;
  position: relative;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #000;
  color: white;
  font-size: 14px;
  font-weight: 600;

  .status-right {
    display: flex;
    gap: 5px;
    align-items: center;
  }

  .signal, .wifi, .battery {
    width: 20px;
    height: 12px;
    background: #fff;
    border-radius: 2px;
  }

  .signal {
    background: linear-gradient(90deg, #fff 0%, #fff 80%, transparent 80%);
  }

  .wifi {
    background: radial-gradient(circle at 50% 50%, transparent 0, transparent 3px, #fff 3px, #fff 6px, transparent 6px);
  }

  .battery {
    position: relative;
    
    &::after {
      content: '';
      position: absolute;
      right: -3px;
      top: 50%;
      transform: translateY(-50%);
      width: 2px;
      height: 6px;
      background: #fff;
      border-radius: 0 1px 1px 0;
    }
  }
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: white;
  border-bottom: 1px solid #e0e0e0;

  .back-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f5f5f5;
    cursor: pointer;
    transition: background-color 0.3s ease;

    &:hover {
      background: #e0e0e0;
    }
  }

  .page-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
  }

  .header-actions {
    display: flex;
    gap: 10px;

    .action-icon {
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
      background: #f5f5f5;
      cursor: pointer;
      transition: background-color 0.3s ease;

      &:hover {
        background: #e0e0e0;
      }
    }
  }
}

.search-section {
  padding: 15px 20px;
  background: white;
  border-bottom: 1px solid #e0e0e0;

  .search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;

    .search-icon {
      position: absolute;
      left: 12px;
      color: #999;
    }

    .search-input {
      width: 100%;
      padding: 12px 40px 12px 40px;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      font-size: 16px;
      outline: none;
      transition: border-color 0.3s ease;

      &:focus {
        border-color: #1877F2;
      }

      &::placeholder {
        color: #999;
      }
    }

    .clear-button {
      position: absolute;
      right: 12px;
      width: 20px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: #999;
      border-radius: 50%;
      transition: background-color 0.3s ease;

      &:hover {
        background: #f0f0f0;
      }
    }
  }
}

.filter-section {
  padding: 15px 20px;
  background: white;
  border-bottom: 1px solid #e0e0e0;

  .filter-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;

    .filter-tab {
      padding: 8px 16px;
      border-radius: 20px;
      background: #f5f5f5;
      color: #666;
      font-size: 14px;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.3s ease;

      &:hover {
        background: #e0e0e0;
      }

      &.active {
        background: #1877F2;
        color: white;
      }
    }
  }
}

.reports-list {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  scroll-behavior: smooth;

  .report-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: white;
    margin: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }

    .report-icon {
      width: 50px;
      height: 50px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #f0f8ff;
      border-radius: 12px;
      margin-right: 15px;
      color: #1877F2;
    }

    .report-details {
      flex: 1;

      .report-title {
        font-size: 16px;
        font-weight: 600;
        color: #333;
        margin-bottom: 5px;
      }

      .report-info {
        display: flex;
        gap: 15px;
        margin-bottom: 8px;
        font-size: 14px;
        color: #666;

        .report-date {
          color: #1877F2;
        }
      }

      .report-status {
        display: inline-block;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 500;

        &.normal {
          background: #e8f5e8;
          color: #52c41a;
        }

        &.abnormal {
          background: #fff2f0;
          color: #ff4d4f;
        }

        &.warning {
          background: #fff7e6;
          color: #fa8c16;
        }
      }
    }

    .report-actions {
      display: flex;
      align-items: center;
      gap: 10px;

      .favorite-button {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: #f5f5f5;
        cursor: pointer;
        transition: all 0.3s ease;
        color: #999;

        &:hover {
          background: #ffe6e6;
          color: #ff6b6b;
        }

        &.active {
          background: #ffe6e6;
          color: #ff6b6b;
        }
      }

      .arrow {
        color: #ccc;
      }
    }
  }

  .load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
    font-size: 14px;

    .loading-spinner {
      margin-right: 10px;
      animation: spin 1s linear infinite;
    }
  }

  .no-more {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 14px;
  }

  .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;

    .empty-icon {
      margin-bottom: 20px;
      color: #ccc;
    }

    h3 {
      margin: 0 0 10px 0;
      font-size: 18px;
      color: #666;
    }

    p {
      margin: 0;
      font-size: 14px;
    }
  }
}

// 模态框样式
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;

  .modal-content {
    background: white;
    border-radius: 16px;
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 20px;
      border-bottom: 1px solid #e0e0e0;

      h2 {
        margin: 0;
        font-size: 18px;
        color: #333;
      }

      .close-button {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: #f5f5f5;
        cursor: pointer;
        transition: background-color 0.3s ease;

        &:hover {
          background: #e0e0e0;
        }
      }
    }

    .modal-body {
      flex: 1;
      overflow-y: auto;
      padding: 20px;

      .report-summary {
        background: #f8f9fa;
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 20px;

        .summary-item {
          display: flex;
          justify-content: space-between;
          margin-bottom: 10px;

          &:last-child {
            margin-bottom: 0;
          }

          .label {
            color: #666;
            font-size: 14px;
          }

          .value {
            color: #333;
            font-weight: 500;

            &.status {
              padding: 4px 8px;
              border-radius: 12px;
              font-size: 12px;

              &.normal {
                background: #e8f5e8;
                color: #52c41a;
              }

              &.abnormal {
                background: #fff2f0;
                color: #ff4d4f;
              }

              &.warning {
                background: #fff7e6;
                color: #fa8c16;
              }
            }
          }
        }
      }

      .doctor-analysis {
        margin-bottom: 20px;

        h3 {
          margin: 0 0 15px 0;
          font-size: 16px;
          color: #333;
        }

        .analysis-content {
          background: #f8f9fa;
          border-radius: 12px;
          padding: 20px;

          .doctor-info {
            display: flex;
            align-items: center;
            margin-bottom: 15px;

            .doctor-avatar {
              width: 50px;
              height: 50px;
              border-radius: 50%;
              overflow: hidden;
              margin-right: 15px;

              img {
                width: 100%;
                height: 100%;
                object-fit: cover;
              }
            }

            .doctor-details {
              .doctor-name {
                font-size: 16px;
                font-weight: 600;
                color: #333;
                margin-bottom: 5px;
              }

              .doctor-title {
                font-size: 14px;
                color: #666;
              }
            }
          }

          .analysis-text {
            font-size: 14px;
            line-height: 1.6;
            color: #333;
            margin-bottom: 15px;
          }

          .analysis-date {
            font-size: 12px;
            color: #999;
          }
        }
      }

      .report-details-section {
        h3 {
          margin: 0 0 15px 0;
          font-size: 16px;
          color: #333;
        }

        .details-list {
          .detail-item {
            background: #f8f9fa;
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 10px;

            &:last-child {
              margin-bottom: 0;
            }

            .detail-header {
              display: flex;
              justify-content: space-between;
              align-items: center;
              margin-bottom: 8px;

              .detail-title {
                font-size: 14px;
                font-weight: 500;
                color: #333;
              }

              .detail-value {
                font-size: 14px;
                font-weight: 500;

                &.normal {
                  color: #52c41a;
                }

                &.abnormal {
                  color: #ff4d4f;
                }

                &.warning {
                  color: #fa8c16;
                }
              }
            }

            .detail-description {
              font-size: 12px;
              color: #666;
              line-height: 1.4;
            }
          }
        }
      }
    }

    .modal-footer {
      display: flex;
      gap: 15px;
      padding: 20px;
      border-top: 1px solid #e0e0e0;

      button {
        flex: 1;
        padding: 12px;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.3s ease;

        &.btn-secondary {
          background: #f5f5f5;
          color: #666;

          &:hover {
            background: #e0e0e0;
          }
        }

        &.btn-primary {
          background: #1877F2;
          color: white;

          &:hover {
            background: #005AFF;
          }
        }
      }
    }
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

// 响应式设计
@media (max-width: 768px) {
  .header {
    padding: 10px 15px;

    .page-title {
      font-size: 16px;
    }
  }

  .search-section,
  .filter-section {
    padding: 10px 15px;
  }

  .reports-list {
    .report-item {
      margin: 8px 15px;
      padding: 15px;

      .report-icon {
        width: 40px;
        height: 40px;
        margin-right: 12px;
      }

      .report-details {
        .report-title {
          font-size: 15px;
        }

        .report-info {
          font-size: 13px;
        }
      }
    }
  }

  .modal-overlay {
    padding: 10px;

    .modal-content {
      .modal-header {
        padding: 15px;

        h2 {
          font-size: 16px;
        }
      }

      .modal-body {
        padding: 15px;
      }

      .modal-footer {
        padding: 15px;
      }
    }
  }
}
</style> 